package cn.xf.dao;

import cn.xf.domain.Permission;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author xiaofu
 * @date 2021-05-18 11:28
 * @email dearaf@163.com
 */
public interface IPermissionDao {

    @Select("select * from permission where id in (select permissionId from role_permission where roleId=#{roleId})")
    public List<Permission> findByRoleId(String roleId);

    @Select("select * from permission")
    List<Permission> findAll();

    @Insert("insert into permission(permissionName,url) values (#{permissionName},#{url})")
    void save(Permission permission);

    @Select("select * from permission where id not in( select permissionId from role_permission where roleId=#{roleId})")
    List<Permission> findOtherPermission(String roleId);
}
